package cn.iocoder.yudao.module.infra.tts.impl.bytedance;

import lombok.Data;

import java.util.UUID;

@Data
public class ByteDanceTtsRequest {

    public ByteDanceTtsRequest() {
    }

    public ByteDanceTtsRequest(String appId) {
        this.app = new App();
        this.app.setAppid(appId);
        this.user = new User();
        this.audio = new Audio();
        this.request = new Request();
    }

    private App app;
    private User user;
    private Audio audio = new Audio();
    private Request request = new Request();

    public void setText(String text) {
        this.request = new Request();
        this.request.setText(text);
    }

    public void setSpkId(String spkId) {
        this.audio.setVoice_type(spkId);
    }

    @Data
    public static class App {
        private String appid;
        private String token = "access_token"; // 目前未生效，填写默认值：access_token
        private String cluster = "volcano_icl";
    }

    @Data
    public static class User {
        private String uid = "2101981396"; // 目前未生效，填写一个默认值就可以
    }

    @Data
    public static class Audio {
        private String voice_type;
        private String encoding = "mp3";
        private double speed_ratio = 1.0;
        private float volume_ratio = 10;
        private float pitch_ratio = 10;
        private String emotion = "happy";
    }

    @Data
    public static class Request {
        private String reqid = UUID.randomUUID().toString();
        private String text;
        private String text_type = "plain";
        private String operation = "query";
    }
}